<!--  -->
<template>
  <div class="newsInfo">
    <!-- <h3>新闻详情---{{$route.params.id}}</h3> -->
    <h3 class="title">{{newsInfo.title}}</h3>
    <p class="subTitle"><span>发表时间:{{newsInfo.add_time|dateFormat}}</span><span>点击次数:{{newsInfo.click}}次</span></p>
    <hr />
    <div class="content" v-html="newsInfo.content"></div>
    <comment :id="this.newsId"></comment>
  </div>
</template>

<script>
import { Toast } from "mint-ui";
import comment from '../subcomponents/comment'
export default {
  components: {},
  data() {
    return {
      newsId: this.$route.params.id,
      newsInfo:[]
    };
  },
  components:{
    comment
  },
  created(){
      this.getNewsInfo()
  },
  methods: {
      getNewsInfo(){
        this.$http.get('api/getnew/'+this.newsId).then((res)=>{
          if(res.body.status===0){
             this.newsInfo=res.body.message[0]
          }else{
                Toast("数据加载失败");
          }
        })
      }
  },
};
</script>
<style lang='scss' scoped>
.newsInfo {
  padding: 0 4px;
  .title {
    color: red;
    font-size: 16px;
    margin: 15px 0;
    text-align: center;
  }
  .subTitle {
    display: flex;
    justify-content: space-between;
    span {
        color: #226aff;
        font-size: 13px;
    }
  }
  .content {
      font-size: 16px;
      color: #6666;
  }
}
</style>